import { UserId } from './user';

export interface Nagget {
	author: UserId;
	content: Array<NaggetContent>;
	postTime: Date;
}

export interface NaggetContent {
	type: 'text' | 'image' | 'url' | 'audio' | 'video';
	content: string;
}

export function isNaggetContent(stuff: any): stuff is NaggetContent {
	if (!(stuff instanceof Object)) {
		return false;
	}
	switch (stuff.type) {
		default:
			return false;
		case 'text':
		case 'image':
		case 'url':
		case 'audio':
		case 'video':
	}
	return typeof stuff.content == 'string';
}
